import styles from './index.module.less'
import type { TeacherReportData } from '@/pages/report/teacher/interface'
import { ConditionRender } from './ConditionRender'
import { percentToNum } from '@/utils/percentToNum'

export const TeacherReport = (props: { data?: TeacherReportData }) => {
    const data = props.data

    return (
        <div className={styles.content}>
            <div>
                <p>{data?.create_date}</p>
                <p>{`您第一次来到${data?.platform}`}</p>
            </div>

            <ConditionRender condition={Boolean(data?.is_show_basic_student)}>
                <div>
                    <p>
                        2024，您开展了
                        <span>{`${data?.basic_student_module?.total_course_num || 0}`}</span>
                        个培训项目
                    </p>
                    <p>
                        <span>{`${data?.basic_student_module?.total_group_num || 0}`}</span>
                        期班级，共
                        <span>{`${data?.basic_student_module?.total_student_num || 0}`}</span>
                        名参训学员
                    </p>
                    <p>
                        有
                        <span>{`${
                            data?.basic_student_module?.total_quality_student_num || 0
                        }`}</span>
                        人培训合格，合格率
                        <span>{`${data?.basic_student_module?.quality_percent || '0%'}`}</span>
                    </p>
                    <p>
                        授课时长<span>{`${data?.basic_student_module?.teach_time || '-'}`}</span>
                    </p>
                    {percentToNum(data?.basic_student_module?.teach_percent) >= 80 && (
                        <p>
                            超过
                            <span>{`${data?.basic_student_module?.teach_percent || '0%'}`}</span>
                            的讲师
                        </p>
                    )}
                </div>
            </ConditionRender>

            <ConditionRender condition={Boolean(data?.is_show_expert_student)}>
                <div>
                    <p>
                        考评<span>{`${data?.expert_student_module?.score_group || 0}`}</span>个班级
                    </p>
                    <p>
                        共<span>{`${data?.expert_student_module?.score_student_num || 0}`}</span>
                        名学员，超过
                        <span>{`${data?.expert_student_module?.score_percent || '0%'}`}</span>的专家
                    </p>
                </div>
            </ConditionRender>

            <ConditionRender condition={Boolean(data?.is_show_region_student)}>
                <div>
                    <p>
                        <span>
                            {data?.region_student_module
                                .map(item => `【${item.region}】`)
                                .join('、')}
                        </span>
                        有您的授课足迹
                    </p>
                </div>
            </ConditionRender>

            <ConditionRender condition={Boolean(data?.is_show_special_day)}>
                <div>
                    <p>{`${data?.special_day_module.time || '-'}授课时间是${
                        Number(data?.special_day_module.hour || 0) > 0
                            ? `${data?.special_day_module.hour}小时`
                            : ''
                    }${
                        Number(data?.special_day_module.minute || 0) > 0
                            ? `${data?.special_day_module.minute}分`
                            : ''
                    }`}</p>
                    <p>是全年授课时间最多的一天</p>
                </div>
            </ConditionRender>

            <ConditionRender condition={Boolean(data?.is_show_category_student)}>
                <div>
                    <p>
                        参训学员类型最多的是
                        <span>{`【${data?.category_student_module.category || '-'}】`}</span>
                    </p>
                </div>
            </ConditionRender>

            <ConditionRender condition={Boolean(data?.is_show_degree_student)}>
                <div>
                    <p>
                        参训学员文化程度最多的是
                        <span>{`【${data?.degree_student_module.degree || '-'}】`}</span>
                    </p>
                </div>
            </ConditionRender>

            <div>
                <p>
                    培训时间集中在<span>{`【${data?.busy_quarter}】`}</span>
                </p>
            </div>

            <ConditionRender condition={Boolean(data?.is_show_course_student)}>
                <div>
                    <p>
                        <span>{`【${data?.course_student_module[0]?.course_name || '-'}】`}</span>
                        培训量最高
                    </p>
                </div>
            </ConditionRender>

            <ConditionRender condition={Boolean(data?.is_show_expert_course)}>
                <div>
                    <p>
                        <span>{`【${data?.expert_course_module[0]?.course_name || '-'}】`}</span>
                        考评量最高
                    </p>
                </div>
            </ConditionRender>

            <div>
                <p>
                    很荣幸能陪伴您走过<span>{`${data?.live_day}`}</span>天
                </p>
                <p>{`2025,${'马兰花创业培训教学管理服务平台'}与您一起为创业之路，奠定坚实基础`}</p>
            </div>
        </div>
    )
}
